package com.llj.Road_curve_measuring_system.bean;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class yjiResult {
    private String id;

    private double licheng;

    private double quxianchang;

    private String pianjiao;

//    private double xianchang;
//
//    private String fangweijiao;

    private double x;

    private double y;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getLicheng() {
        return licheng;
    }

    public void setLicheng(double licheng) {
        this.licheng = licheng;
    }

    public double getQuxianchang() {
        return quxianchang;
    }

    public void setQuxianchang(double quxianchang) {
        this.quxianchang = quxianchang;
    }

    public String getPianjiao() {
        return pianjiao;
    }

    public void setPianjiao(String pianjiao) {
        this.pianjiao = pianjiao;
    }

//    public double getXianchang() {
//        return xianchang;
//    }
//
//    public void setXianchang(double xianchang) {
//        this.xianchang = xianchang;
//    }
//
//    public String getFangweijiao() {
//        return fangweijiao;
//    }
//
//    public void setFangweijiao(String fangweijiao) {
//        this.fangweijiao = fangweijiao;
//    }

    public double getX() {
        return x;
    }

    public void setX(double x) {
        this.x = x;
    }

    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }

    public yjiResult(String id, double licheng, double quxianchang, String pianjiao, double xianchang, String fangweijiao, double x, double y) {
        licheng = formatDouble2(licheng);
        quxianchang = formatDouble2(quxianchang);
        x = formatDouble2(x);
        y = formatDouble2(y);
        this.id = id;
        this.licheng = licheng;
        this.quxianchang = quxianchang;
        this.pianjiao = pianjiao;
//        this.xianchang = xianchang;
//        this.fangweijiao = fangweijiao;
        this.x = x;
        this.y = y;
    }

    public static double formatDouble2(double d) {

        // 新方法，如果不需要四舍五入，可以使用RoundingMode.DOWN
        BigDecimal bg = new BigDecimal(d).setScale(2, RoundingMode.UP);


        return bg.doubleValue();
    }

    public yjiResult() {
        this.id = "1";
    }
}
